import 'package:safetymonitor/generated/json/base/json_convert_content.dart';
import 'package:safetymonitor/app/data/entities/home/analysis/get_risk_entity.dart';

GetRiskEntity $GetRiskEntityFromJson(Map<String, dynamic> json) {
  final GetRiskEntity getRiskEntity = GetRiskEntity();
  final String? createTime = jsonConvert.convert<String>(json['createTime']);
  if (createTime != null) {
    getRiskEntity.createTime = createTime;
  }
  final String? updateTime = jsonConvert.convert<String>(json['updateTime']);
  if (updateTime != null) {
    getRiskEntity.updateTime = updateTime;
  }
  final String? creator = jsonConvert.convert<String>(json['creator']);
  if (creator != null) {
    getRiskEntity.creator = creator;
  }
  final String? updater = jsonConvert.convert<String>(json['updater']);
  if (updater != null) {
    getRiskEntity.updater = updater;
  }
  final bool? deleted = jsonConvert.convert<bool>(json['deleted']);
  if (deleted != null) {
    getRiskEntity.deleted = deleted;
  }
  final int? id = jsonConvert.convert<int>(json['id']);
  if (id != null) {
    getRiskEntity.id = id;
  }
  final int? companyId = jsonConvert.convert<int>(json['companyId']);
  if (companyId != null) {
    getRiskEntity.companyId = companyId;
  }
  final String? riskName = jsonConvert.convert<String>(json['riskName']);
  if (riskName != null) {
    getRiskEntity.riskName = riskName;
  }
  final int? responsibleDeptId = jsonConvert.convert<int>(json['responsibleDeptId']);
  if (responsibleDeptId != null) {
    getRiskEntity.responsibleDeptId = responsibleDeptId;
  }
  final int? responsibleUserId = jsonConvert.convert<int>(json['responsibleUserId']);
  if (responsibleUserId != null) {
    getRiskEntity.responsibleUserId = responsibleUserId;
  }
  final int? longitude = jsonConvert.convert<int>(json['longitude']);
  if (longitude != null) {
    getRiskEntity.longitude = longitude;
  }
  final int? latitude = jsonConvert.convert<int>(json['latitude']);
  if (latitude != null) {
    getRiskEntity.latitude = latitude;
  }
  final int? height = jsonConvert.convert<int>(json['height']);
  if (height != null) {
    getRiskEntity.height = height;
  }
  final String? riskTypeCode = jsonConvert.convert<String>(json['riskTypeCode']);
  if (riskTypeCode != null) {
    getRiskEntity.riskTypeCode = riskTypeCode;
  }
  final String? riskTypeName = jsonConvert.convert<String>(json['riskTypeName']);
  if (riskTypeName != null) {
    getRiskEntity.riskTypeName = riskTypeName;
  }
  final String? riskLevelCode = jsonConvert.convert<String>(json['riskLevelCode']);
  if (riskLevelCode != null) {
    getRiskEntity.riskLevelCode = riskLevelCode;
  }
  final String? riskLevelName = jsonConvert.convert<String>(json['riskLevelName']);
  if (riskLevelName != null) {
    getRiskEntity.riskLevelName = riskLevelName;
  }
  final String? modelCode = jsonConvert.convert<String>(json['modelCode']);
  if (modelCode != null) {
    getRiskEntity.modelCode = modelCode;
  }
  final int? riskType = jsonConvert.convert<int>(json['riskType']);
  if (riskType != null) {
    getRiskEntity.riskType = riskType;
  }
  final String? dangerName = jsonConvert.convert<String>(json['dangerName']);
  if (dangerName != null) {
    getRiskEntity.dangerName = dangerName;
  }
  final String? consequence = jsonConvert.convert<String>(json['consequence']);
  if (consequence != null) {
    getRiskEntity.consequence = consequence;
  }
  final String? controlMeasures = jsonConvert.convert<String>(json['controlMeasures']);
  if (controlMeasures != null) {
    getRiskEntity.controlMeasures = controlMeasures;
  }
  final String? managementHierarchy = jsonConvert.convert<String>(json['managementHierarchy']);
  if (managementHierarchy != null) {
    getRiskEntity.managementHierarchy = managementHierarchy;
  }
  final String? responsibleDepts = jsonConvert.convert<String>(json['responsibleDepts']);
  if (responsibleDepts != null) {
    getRiskEntity.responsibleDepts = responsibleDepts;
  }
  final String? responsibleUsers = jsonConvert.convert<String>(json['responsibleUsers']);
  if (responsibleUsers != null) {
    getRiskEntity.responsibleUsers = responsibleUsers;
  }
  final List<dynamic>? deptIds = (json['deptIds'] as List<dynamic>?)?.map(
          (e) => e).toList();
  if (deptIds != null) {
    getRiskEntity.deptIds = deptIds;
  }
  final List<dynamic>? userIds = (json['userIds'] as List<dynamic>?)?.map(
          (e) => e).toList();
  if (userIds != null) {
    getRiskEntity.userIds = userIds;
  }
  final int? nodeId = jsonConvert.convert<int>(json['nodeId']);
  if (nodeId != null) {
    getRiskEntity.nodeId = nodeId;
  }
  final String? workType = jsonConvert.convert<String>(json['workType']);
  if (workType != null) {
    getRiskEntity.workType = workType;
  }
  final String? workActivity = jsonConvert.convert<String>(json['workActivity']);
  if (workActivity != null) {
    getRiskEntity.workActivity = workActivity;
  }
  final String? dangerSource = jsonConvert.convert<String>(json['dangerSource']);
  if (dangerSource != null) {
    getRiskEntity.dangerSource = dangerSource;
  }
  return getRiskEntity;
}

Map<String, dynamic> $GetRiskEntityToJson(GetRiskEntity entity) {
  final Map<String, dynamic> data = <String, dynamic>{};
  data['createTime'] = entity.createTime;
  data['updateTime'] = entity.updateTime;
  data['creator'] = entity.creator;
  data['updater'] = entity.updater;
  data['deleted'] = entity.deleted;
  data['id'] = entity.id;
  data['companyId'] = entity.companyId;
  data['riskName'] = entity.riskName;
  data['responsibleDeptId'] = entity.responsibleDeptId;
  data['responsibleUserId'] = entity.responsibleUserId;
  data['longitude'] = entity.longitude;
  data['latitude'] = entity.latitude;
  data['height'] = entity.height;
  data['riskTypeCode'] = entity.riskTypeCode;
  data['riskTypeName'] = entity.riskTypeName;
  data['riskLevelCode'] = entity.riskLevelCode;
  data['riskLevelName'] = entity.riskLevelName;
  data['modelCode'] = entity.modelCode;
  data['riskType'] = entity.riskType;
  data['dangerName'] = entity.dangerName;
  data['consequence'] = entity.consequence;
  data['controlMeasures'] = entity.controlMeasures;
  data['managementHierarchy'] = entity.managementHierarchy;
  data['responsibleDepts'] = entity.responsibleDepts;
  data['responsibleUsers'] = entity.responsibleUsers;
  data['deptIds'] = entity.deptIds;
  data['userIds'] = entity.userIds;
  data['nodeId'] = entity.nodeId;
  data['workType'] = entity.workType;
  data['workActivity'] = entity.workActivity;
  data['dangerSource'] = entity.dangerSource;
  return data;
}

extension GetRiskEntityExtension on GetRiskEntity {
  GetRiskEntity copyWith({
    String? createTime,
    String? updateTime,
    String? creator,
    String? updater,
    bool? deleted,
    int? id,
    int? companyId,
    String? riskName,
    int? responsibleDeptId,
    int? responsibleUserId,
    int? longitude,
    int? latitude,
    int? height,
    String? riskTypeCode,
    String? riskTypeName,
    String? riskLevelCode,
    String? riskLevelName,
    String? modelCode,
    int? riskType,
    String? dangerName,
    String? consequence,
    String? controlMeasures,
    String? managementHierarchy,
    String? responsibleDepts,
    String? responsibleUsers,
    List<dynamic>? deptIds,
    List<dynamic>? userIds,
    int? nodeId,
    String? workType,
    String? workActivity,
    String? dangerSource,
  }) {
    return GetRiskEntity()
      ..createTime = createTime ?? this.createTime
      ..updateTime = updateTime ?? this.updateTime
      ..creator = creator ?? this.creator
      ..updater = updater ?? this.updater
      ..deleted = deleted ?? this.deleted
      ..id = id ?? this.id
      ..companyId = companyId ?? this.companyId
      ..riskName = riskName ?? this.riskName
      ..responsibleDeptId = responsibleDeptId ?? this.responsibleDeptId
      ..responsibleUserId = responsibleUserId ?? this.responsibleUserId
      ..longitude = longitude ?? this.longitude
      ..latitude = latitude ?? this.latitude
      ..height = height ?? this.height
      ..riskTypeCode = riskTypeCode ?? this.riskTypeCode
      ..riskTypeName = riskTypeName ?? this.riskTypeName
      ..riskLevelCode = riskLevelCode ?? this.riskLevelCode
      ..riskLevelName = riskLevelName ?? this.riskLevelName
      ..modelCode = modelCode ?? this.modelCode
      ..riskType = riskType ?? this.riskType
      ..dangerName = dangerName ?? this.dangerName
      ..consequence = consequence ?? this.consequence
      ..controlMeasures = controlMeasures ?? this.controlMeasures
      ..managementHierarchy = managementHierarchy ?? this.managementHierarchy
      ..responsibleDepts = responsibleDepts ?? this.responsibleDepts
      ..responsibleUsers = responsibleUsers ?? this.responsibleUsers
      ..deptIds = deptIds ?? this.deptIds
      ..userIds = userIds ?? this.userIds
      ..nodeId = nodeId ?? this.nodeId
      ..workType = workType ?? this.workType
      ..workActivity = workActivity ?? this.workActivity
      ..dangerSource = dangerSource ?? this.dangerSource;
  }
}